#pragma once

#include <map>
#include "Graphic.h"

class U7FilesLoader;
class WorldMap;
class MapChunk;
class BasicObject;
struct SHAPEID;

class Renderer
{
public:
	static void FreeResources();

private:
	static unsigned	renderSeq;
	static std::map<SHAPEID,char*> reflectMap;

	// variables below are initialized in the constructor

	// variables below are set in the function Paint()
	PGRAPHIC		graphic;
	U7FilesLoader*	files;
	int				maxZLevel; // -2: base tiles only, -1: base tiles and flat objects only, 0:...

	void PaintTerrainTiles( int ox, int oy, MapChunk* mapChunk );
	void PaintTerrainFlats( int ox, int oy, MapChunk* mapChunk );
	void PaintChunkObjects( int ox, int oy, MapChunk* mapChunk );
	void PaintObject( int ox, int oy, BasicObject* obj );

public:
	Renderer();

	void Paint( PGRAPHIC g, int ox, int oy, WorldMap& map, int zlimit = 32 );

	void PaintTerrainTiles( PGRAPHIC g, const U7FilesLoader& files, int patternID );
};

inline
Renderer::Renderer()
{
}
